#!/bin/bash

export APPROOT="$PWD"
export LIBROOT="$APPROOT/lib"
export DJANGO="$LIBROOT/django"
export FEEDJACK="$LIBROOT/feedjack"

export PATH="$LIBROOT/django/django/bin:$LIBROOT/feedjack/feedjack/bin:$PATH"
export PYTHONPATH="$APPROOT/..:$APPROOT:$LIBROOT:$DJANGO:$FEEDJACK:$PYTHONPATH"

export DJANGO_SETTINGS_MODULE="python-cn.settings"

export MEDIAROOT="$APPROOT/static"

# aliases
alias dj="python manage.py"
alias pycn="python manage.py runserver 0:8000"

# default database settings
export DATABASE_USER="ringier"
export DATABASE_NAME="python-cn"

test -f local-setup-env.sh && source local-setup-env.sh

# shortcuts
function ss {
    svn st $* | grep "^[ ACDIMRX?!~][ CM][ L][ +][ S][ KOTB]" | grep -v "^X"
}

function svncolordiff {
    svn diff $* | colordiff | less -r
}

function reset-db {
    dropdb $DATABASE_NAME -U $DATABASE_USER
    createdb $DATABASE_NAME -U $DATABASE_USER &&
    dj syncdb --noinput --verbosity=0
}
